// ApngImage.h

#pragma once

#include <png.h>

using namespace System;
using namespace System::Windows;
using namespace System::Windows::Threading;
using namespace System::Windows::Controls;
using namespace System::Windows::Media::Imaging;

namespace Apng 
{
	public ref class ApngImage : Image
	{
	private:
		png_struct * _png;
		png_info * _info;
		FILE * _fileHandle;
		DispatcherTimer^ _timer;
        WriteableBitmap^ _bitmap;
	public:
		//[Bindable(true), DefaultValue("")]
		property String^ Path;
		property int Fps;

		ApngImage();
		void OnLoaded(Object^ source, RoutedEventArgs^ e);
		void OnUnloaded(Object^ source, RoutedEventArgs^ e);
		void Tick(Object^ source, EventArgs^ e);
	private:
		void Open();
		void Close();
	};
}
